<?php include "header.html"; ?> 

<body>
 
	<div class="zss-wrap">

		<div class="zss-header">
            <span class="layui-breadcrumb">
                <?= $this->get_loc($this->baseClass . '?mid=' . $global["mid"], "编辑"); ?>
            </span>
        </div>

		<div class="zss-nav">
			<a type="button" class="layui-btn" href="<?= U($this->baseClass, $this->getArgs()) ?>">
				<i class="layui-icon layui-icon-return"></i> 返回 
			</a>
		</div>

		<div class="zss-content">

			<div class="layui-tab layui-tab-brief">
				<ul class="layui-tab-title">
					<a><li class="layui-this">添加<?= $global["res_tpl"]["category_name"] ?></li></a>
				</ul>
			</div>

			<div class="zss-form-box">
				<form action="<?= U($this->baseClass . '/submit', $this->getArgs()) ?>" method="post" class="layui-form">
					<div class="layui-form-item">
						<label class="layui-form-label">内容标题</label>
						<div class="layui-input-block">
							<input type="text" name="con_name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_name'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">内容别名</label>
						<div class="layui-input-block">
							<input type="text" name="con_alias" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_alias'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">自定义路径</label>
						<div class="layui-input-block">
							<input type="text" name="con_path" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_path'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">内容描述</label>
						<div class="layui-input-block">
							<textarea name="con_description" placeholder="请输入内容" class="layui-textarea"><?= $row['con_description'] ?></textarea>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">所属分类</label>
						<div class="layui-input-block">
							<select name="con_cid" lay-verify="required">
								<option value="">请选择分类 --- </option>                 
								<?= $this->recursive_category_select_new($global["mid"], $row['con_cid'], ' and category_add = 1'); ?>
							</select>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">关联内容</label>
						<div class="layui-input-block">

							<div class="layui-transfer-box" data-index="0" style="width: 100%; max-height: 200px; height: auto; overflow: hidden;">
								<ul class="layui-transfer-data" style="max-height: 200px;">
									<?php

									$plist = \core\libs\db::fetchAll("content, category", "con_cid = category_id and con_id <> '$row[con_id]' order by con_hot desc, con_top desc, con_order, con_time desc");
									
									if($plist) {
										foreach($plist as $vp) {
											$ids = explode(',', $row['con_link_id']);
										?>
										<li>
											<input type="checkbox" name="con_link_id[]" lay-skin="primary" title="<?=$vp['con_name']?>" value="<?=$vp['con_id']?>" <?php if(in_array($vp['con_id'], $ids)) { ?>checked<?php }?>>
										</li>
										<?php }?>
									<?php }else { ?>
										<li style="color: #999;">没有相关内容</li>
									<?php }?>
								</ul>
							</div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">详细内容</label>
						<div class="layui-input-block" style="background: #f7f7f7; padding: 10px; border: 1px solid #e6e6e6;">
							<?php kindeditor("content1", "con_content", kindhtml($row['con_content'])) ?> 
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">精彩图集</label>
						<div class="layui-input-block" style="background: #f7f7f7; padding: 10px; border: 1px solid #e6e6e6;">
							<?php $this->get_upload_multiple("multiple1", "con_pic", $row['con_pic']); ?>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">图片</label>
						<div class="layui-input-block">
							<?php $this->get_upload_image("pic1", "con_pic", $row['con_pic'], 2); ?>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">视频</label>
						<div class="layui-input-block">
							<?php $this->get_upload_video("video1", "con_video", $row['con_video']); ?>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">文件</label>
						<div class="layui-input-block">
							<?php $this->get_upload_file("file1", "con_file", $row['con_file']); ?>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">发布时间</label>
						<div class="layui-input-block">
							<input type="text" name="con_time" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_time'] ? date('Y-m-d H:i:s', $row['con_time']) : date('Y-m-d H:i:s') ?>" id="input_time">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">来源</label>
						<div class="layui-input-block">
							<input type="text" name="con_source" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_source'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">连接</label>
						<div class="layui-input-block">
							<input type="text" name="con_url" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_url'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">权重排序</label>
						<div class="layui-input-block">
							<input type="text" name="con_order" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_order'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">内容模板</label>
						<div class="layui-input-block">
							<input type="text" name="con_tpl" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['con_tpl'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">属性</label>
						<div class="layui-input-block">
							<input type="checkbox" name="con_top" value="1" title="置顶" <?php if($row['con_top'] == 1) { echo 'checked'; }?>>
                          	<input type="checkbox" name="con_hot" value="1" title="推荐" <?php if($row['con_hot'] == 1) { echo 'checked'; }?>>  
						</div>
					</div>

					  

					<div class="layui-form-item">
						<label class="layui-form-label">状态</label>
						<div class="layui-input-block">
							<input type="checkbox" value="1" name="con_state" lay-skin="switch" lay-text="取消|通过" <?php if($row['con_state'] != '0') { echo 'checked'; }?>>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">SEO标题</label>
						<div class="layui-input-block">
						  <input type="text" name="con_seo_title" placeholder="SEO标题" autocomplete="off" class="layui-input" value="<?= $row['con_seo_title'] ?>">
						</div>
					</div>
  
					<div class="layui-form-item">
						<label class="layui-form-label">SEO关键字</label>
						<div class="layui-input-block">
						  <input type="text" name="con_seo_keywords" placeholder="SEO关键字" autocomplete="off" class="layui-input" value="<?= $row['con_seo_keywords'] ?>">
						</div>
					</div>
  
					<div class="layui-form-item">
						<label class="layui-form-label">SEO描述</label>
						<div class="layui-input-block">
						  <textarea name="con_seo_description" placeholder="SEO描述" class="layui-textarea"><?= $row['con_seo_description'] ?></textarea>
						</div>
					</div>

					<div class="layui-form-item">
						<div class="layui-input-block">
						  <input type="hidden" value="<?= $global['id'] ?>" name="id" />
						  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
						</div>
					</div>
				</form>
			</div>

		</div>
	</div>
	
	<script>
		layui.use(['element', 'form', 'laydate'], function() {
			var laydate = layui.laydate;
			//执行一个laydate实例
			laydate.render({
				elem: '#input_time' //指定元素
				,type: 'datetime'
			});
		});
	</script>
</form>  
</body>
</html>
